package com.java.dao;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

import com.java.vo.PointRuleVo;

/**
 * PointRuleDao
 * <p>
 * </p>
 *
 * @author Vigor Yuan
 */
@Repository
public class PointRuleDao {

    @Autowired
    private JdbcTemplate jdbcTemplate;

    public List<PointRuleVo> findAllPointRules() {
        return this.jdbcTemplate.query("select rule_id,rule_name from point_rule", (rs, rowNum) -> {
            PointRuleVo ruleVo = new PointRuleVo();
            ruleVo.setId(rs.getInt("rule_id"));
            ruleVo.setRuleName(rs.getString("rule_name"));
            return ruleVo;
        });
    }
}
